home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / Xt / XtCreateWidget.z / XtCreateWidget
Encoding:
Text File  |  1998-10-30  |  11.0 KB  |  265 lines

  1.  
  2.  
  3.  
  4.      XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333)))) XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           XtCreateWidget, XtVaCreateWidget, XtCreateManagedWidget,
  10.           XtVaCreateManagedWidget, XtDestroyWidget - create and
  11.           destroy widgets
  12.  
  13.      SSSSYYYYNNNNTTTTAAAAXXXX
  14.           Widget XtCreateWidget(_n_a_m_e, _w_i_d_g_e_t__c_l_a_s_s, _p_a_r_e_n_t, _a_r_g_s,
  15.           _n_u_m__a_r_g_s)
  16.                 String _n_a_m_e;
  17.                 WidgetClass _w_i_d_g_e_t__c_l_a_s_s;
  18.                 Widget _p_a_r_e_n_t;
  19.                 ArgList _a_r_g_s;
  20.                 Cardinal _n_u_m__a_r_g_s;
  21.  
  22.           Widget XtVaCreateWidget(_n_a_m_e, _w_i_d_g_e_t__c_l_a_s_s, _p_a_r_e_n_t, ...)
  23.                 String _n_a_m_e;
  24.                 WidgetClass _w_i_d_g_e_t__c_l_a_s_s;
  25.                 Widget _p_a_r_e_n_t;
  26.  
  27.           Widget XtCreateManagedWidget(_n_a_m_e, _w_i_d_g_e_t__c_l_a_s_s, _p_a_r_e_n_t,
  28.           _a_r_g_s, _n_u_m__a_r_g_s)
  29.                 String _n_a_m_e;
  30.                 WidgetClass _w_i_d_g_e_t__c_l_a_s_s;
  31.                 Widget _p_a_r_e_n_t;
  32.                 ArgList _a_r_g_s;
  33.                 Cardinal _n_u_m__a_r_g_s;
  34.  
  35.           Widget XtVaCreateManagedWidget(_n_a_m_e, _w_i_d_g_e_t__c_l_a_s_s, _p_a_r_e_n_t,
  36.           ...)
  37.                 String _n_a_m_e;
  38.                 WidgetClass _w_i_d_g_e_t__c_l_a_s_s;
  39.                 Widget _p_a_r_e_n_t;
  40.  
  41.           void XtDestroyWidget(_w)
  42.                 Widget _w;
  43.  
  44.      AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  45.           _a_r_g_s      Specifies the argument list to override the
  46.                     resource defaults.
  47.  
  48.           _n_a_m_e      Specifies the resource name for the created
  49.                     widget, which is used for retrieving resources
  50.                     and, for that reason, should not be the same as
  51.                     any other widget that is a child of same parent.
  52.  
  53.           _n_u_m__a_r_g_s  Specifies the number of arguments in the argument
  54.                     list.
  55.  
  56.           _p_a_r_e_n_t    Specifies the parent widget.
  57.  
  58.           _w         Specifies the widget.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 4/30/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333)))) XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))
  71.  
  72.  
  73.  
  74.           _w_i_d_g_e_t__c_l_a_s_s
  75.                     Specifies the widget class pointer for the created
  76.                     widget.
  77.  
  78.           ...       Specifies the variable argument list to override
  79.                     the resource defaults.
  80.  
  81.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  82.           The _X_t_C_r_e_a_t_e_W_i_d_g_e_t function performs much of the boilerplate
  83.           operations of widget creation:
  84.  
  85.           +o    Checks to see if the class_initialize procedure has
  86.                been called for this class and for all superclasses
  87.                and, if not, calls those necessary in a superclass-to-
  88.                subclass order.
  89.  
  90.           +o    Allocates memory for the widget instance.
  91.  
  92.           +o    If the parent is a subclass of _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s,
  93.                it allocates memory for the parent's constraints and
  94.                stores the address of this memory into the constraints
  95.                field.
  96.  
  97.           +o    Initializes the core nonresource data fields (for
  98.                example, parent and visible).
  99.  
  100.           +o    Initializes the resource fields (for example,
  101.                background_pixel) by using the resource lists specified
  102.                for this class and all superclasses.
  103.  
  104.           +o    If the parent is a subclass of _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s,
  105.                it initializes the resource fields of the constraints
  106.                record by using the constraint resource list specified
  107.                for the parent's class and all superclasses up to
  108.                _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s.
  109.  
  110.           +o    Calls the initialize procedures for the widget by
  111.                starting at the _C_o_r_e initialize procedure on down to
  112.                the widget's initialize procedure.
  113.  
  114.           +o    If the parent is a subclass of _c_o_m_p_o_s_i_t_e_W_i_d_g_e_t_C_l_a_s_s, it
  115.                puts the widget into its parent's children list by
  116.                calling its parent's insert_child procedure.  For
  117.                further information, see Section 3.5.
  118.  
  119.           +o    If the parent is a subclass of _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s,
  120.                it calls the constraint initialize procedures, starting
  121.                at _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s on down to the parent's
  122.                constraint initialize procedure.
  123.  
  124.           Note that you can determine the number of arguments in an
  125.           argument list by using the _X_t_N_u_m_b_e_r macro.  For further
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 4/30/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333)))) XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))
  137.  
  138.  
  139.  
  140.           information, see Section 11.1.
  141.  
  142.           The _X_t_C_r_e_a_t_e_M_a_n_a_g_e_d_W_i_d_g_e_t function is a convenience routine
  143.           that calls _X_t_C_r_e_a_t_e_W_i_d_g_e_t and _X_t_M_a_n_a_g_e_C_h_i_l_d.
  144.  
  145.           The _X_t_D_e_s_t_r_o_y_W_i_d_g_e_t function provides the only method of
  146.           destroying a widget, including widgets that need to destroy
  147.           themselves.  It can be called at any time, including from an
  148.           application callback routine of the widget being destroyed.
  149.           This requires a two-phase destroy process in order to avoid
  150.           dangling references to destroyed widgets.
  151.  
  152.           In phase one, _X_t_D_e_s_t_r_o_y_W_i_d_g_e_t performs the following:
  153.  
  154.           +o    If the being_destroyed field of the widget is _T_r_u_e, it
  155.                returns immediately.
  156.  
  157.           +o    Recursively descends the widget tree and sets the
  158.                being_destroyed field to _T_r_u_e for the widget and all
  159.                children.
  160.  
  161.           +o    Adds the widget to a list of widgets (the destroy list)
  162.                that should be destroyed when it is safe to do so.
  163.  
  164.           Entries on the destroy list satisfy the invariant that if w2
  165.           occurs after w1 on the destroy list then w2 is not a
  166.           descendent of w1.  (A descendant refers to both normal and
  167.           pop-up children.)
  168.  
  169.           Phase two occurs when all procedures that should execute as
  170.           a result of the current event have been called (including
  171.           all procedures registered with the event and translation
  172.           managers), that is, when the current invocation of
  173.           _X_t_D_i_s_p_a_t_c_h_E_v_e_n_t is about to return or immediately if not in
  174.           _X_t_D_i_s_p_a_t_c_h_E_v_e_n_t.
  175.  
  176.           In phase two, _X_t_D_e_s_t_r_o_y_W_i_d_g_e_t performs the following on each
  177.           entry in the destroy list:
  178.  
  179.           +o    Calls the destroy callback procedures registered on the
  180.                widget (and all descendants) in post-order (it calls
  181.                children callbacks before parent callbacks).
  182.  
  183.           +o    If the widget's parent is a subclass of
  184.                _c_o_m_p_o_s_i_t_e_W_i_d_g_e_t_C_l_a_s_s and if the parent is not being
  185.                destroyed, it calls _X_t_U_n_m_a_n_a_g_e_C_h_i_l_d on the widget and
  186.                then calls the widget's parent's delete_child procedure
  187.                (see Section 3.4).
  188.  
  189.           +o    If the widget's parent is a subclass of
  190.                _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s, it calls the constraint destroy
  191.                procedure for the parent, then the parent's superclass,
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 4/30/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((RRRReeeelllleeeeaaaasssseeee 6666....3333)))) XXXXttttCCCCrrrreeeeaaaatttteeeeWWWWiiiiddddggggeeeetttt((((3333XXXXtttt))))
  203.  
  204.  
  205.  
  206.                until finally it calls the constraint destroy procedure
  207.                for _c_o_n_s_t_r_a_i_n_t_W_i_d_g_e_t_C_l_a_s_s.
  208.  
  209.           +o    Calls the destroy methods for the widget (and all
  210.                descendants) in post-order.  For each such widget, it
  211.                calls the destroy procedure declared in the widget
  212.                class, then the destroy procedure declared in its
  213.                superclass, until finally it calls the destroy
  214.                procedure declared in the Core class record.
  215.  
  216.           +o    Calls _X_D_e_s_t_r_o_y_W_i_n_d_o_w if the widget is realized (that
  217.                is, has an X window).  The server recursively destroys
  218.                all descendant windows.
  219.  
  220.           +o    Recursively descends the tree and deallocates all pop-
  221.                up widgets, constraint records, callback lists and, if
  222.                the widget is a subclass of _c_o_m_p_o_s_i_t_e_W_i_d_g_e_t_C_l_a_s_s,
  223.                children.
  224.  
  225.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  226.           XtAppCreateShell(3Xt), XtCreatePopupShell(3Xt)
  227.           _X _T_o_o_l_k_i_t _I_n_t_r_i_n_s_i_c_s - _C _L_a_n_g_u_a_g_e _I_n_t_e_r_f_a_c_e
  228.           _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 4/30/98)
  262.  
  263.  
  264.  
  265.